package com.xx.controller;

import com.xx.pojo.Customer;
import com.xx.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
public class CustomerController {
    @Resource
    private CustomerService customerService;

    @RequestMapping("/findCustomerById")
    public ModelAndView findCustomerById(int id) {
        System.out.println(id);
        ModelAndView modelAndView = new ModelAndView();
        Customer customer = this.customerService.findCustomerById(id);
        System.out.println(customer);
        modelAndView.addObject("msg", customer);
        modelAndView.setViewName("index");
        return modelAndView;
    }
}
